{extend name='admin@main'}

{block name="button"}
{if auth("admin/permission.auth/refresh")}
<!--<button data-load='{:url("refresh")}' class='layui-btn layui-btn-sm layui-btn-primary'>刷新权限</button>-->
<button onclick="window.history.back()" class='layui-btn layui-btn-sm layui-btn-primary'>返回</button>
{/if}
{/block}

{block name="content"}

<div class="think-box-shadow">
    {if auth("admin/setup.options/addOption")}
    <div class="layui-obj">
        <button data-modal='{:url("addOption")}?dropdown_id={$dropdown_id}' data-title="添加选项" class='layui-btn layui-btn-sm layui-btn-primary'>添加</button>
    </div>
    {/if}
    <table class="layui-table margin-top-0" lay-skin="line" data-export-name='table'>
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
            </th>
            <th class='list-table-sort-td'>
                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
            </th>
            <th class='text-left nowrap'>下拉项名称</th>
            <th class='text-left nowrap'>下拉项描述</th>
            <th class='text-left nowrap'>下拉项ID</th>
            <th class="text-center">下拉项状态</th>
            <th class="text-left">更新时间</th>
            <th class="text-center">操作</th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'>
                <input class="list-check-box" value='{$vo.id}' type='checkbox'>
            </td>
            <td class='list-table-sort-td'>
                <input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input">
            </td>
            <td class='text-left nowrap'>{$vo.name|default=''}</td>
            <td class='text-left nowrap'>
                {$vo.desc|default=''}
            </td>
            <td class='text-left nowrap'>
                {$vo.option_id|default=''}
            </td>
            <td class='text-center nowrap'>
            	{if $vo.status eq 1}<span class="color-green">正常</span>
                {elseif $vo.status eq 2}<span class="color-red">禁用</span>
                {/if}
            </td>
            <td class='text-left nowrap'>日期：{$vo.update_at|format_datetime|str_replace=' ','<br><span class="color-desc">时间：',###|raw}</span></td>
            <td class='text-center nowrap'>
            	{if auth("admin/setup.options/editOption")}
                <a data-dbclick data-title="编辑下拉项" class="layui-btn layui-btn-sm" data-modal='{:url("editOption")}?id={$vo.id}'>编 辑</a>
                {/if}
                {if $vo.status eq 1 and auth("admin/setup.options/forbid")}
                <a class="layui-btn layui-btn-warm layui-btn-sm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#2" data-csrf="{:systoken('admin/setup.options/forbid')}">禁 用</a>
                {elseif $vo.status eq 2 and auth("admin/setup.options/resume")}
                <a class="layui-btn layui-btn-warm layui-btn-sm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1" data-csrf="{:systoken('admin/setup.options/resume')}">启 用</a>
                {/if}
            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}


</div>
<style>
    .layui-obj{
        margin-top: 10px!important;
    }
</style>
<script>

</script>
{/block}

